<template>
	<view class="content">
		<view class="wrap">
			<u-row style="margin-bottom: 3%">
			
			</u-row>
				<u-row justify="around" style="margin-bottom: 5%">
					<u-col span="4" offset="2">
						<u-avatar :src="src" mode="circle" :show-sex="true" :sex-icon="sex" size="175"></u-avatar>		
					</u-col>
					<u-col span="6">
						<text style="color:#009000">欢迎！</text> 
						<text style="color:#00bebe">{{account}}</text>
					</u-col>
				</u-row>	
				<u-row justify="center" gutter="16">
					<u-col span="4" text-align="center" @click="onPageTo('/pages/my/selectcourse')">
						<u-icon name="cut" size="100"></u-icon>	
						<text style="color:#ff007f">\n快速选课</text>
					</u-col>
					<u-col span="4" text-align="center" @click="onPageTo('')">
						<u-icon name="heart-fill" size="100"></u-icon>
						<text style="color:#ff007f">\n功能二</text>
					</u-col>
					<u-col span="4" text-align="center" @click="onPageTo('')">
						<u-icon name="heart-fill" size="100"></u-icon>
						<text style="color:#ff007f">\n功能三</text>
					</u-col>
				</u-row>
		</view>		
		<u-gap height="8" bgColor="#e8e8e8"></u-gap>
		<view>
			<u-cell-group>
				<u-cell-item icon="account-fill" title="修改我的信息" @click="onPageTo('/pages/my/info')">
		
				</u-cell-item>
				<u-cell-item icon="map" title="我的课表" @click="onPageTo('/pages/my/course')">
					
				</u-cell-item>
				<u-cell-item icon="map" title="我的成绩" @click="onPageTo('/pages/my/score')">

				</u-cell-item>
				<u-cell-item icon="map" title="教学评价" @click="onPageTo('/pages/my/evaluate')">
				
				</u-cell-item>
				<u-cell-item icon="map" title="我的一卡通" @click="HxGopage('/pages/card/card',studentId)">

				</u-cell-item>
				<u-cell-item icon="map" title="隐患上报" @click="hidden('/pages/xjh/hidden',studentId)">
				
				</u-cell-item>
				<u-cell-item icon="map" title="我的上报" @click="hidden('/pages/xjh/myHidden',studentId)">

				</u-cell-item>
			</u-cell-group>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// studentId:"6", //该参数用于学生服务断开时测试，届时打开
				studentId:null,
				src: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsngedu-punch-1251502357.cos.ap-guangzhou.myqcloud.com%2Fagency_picurl%2FQFzQYCgCrxmeXicuR6JnsP153UAFZbcic3G7EKm7rOlrcMgPhLeODwNM81abKGTLkd&refer=http%3A%2F%2Fsngedu-punch-1251502357.cos.ap-guangzhou.myqcloud.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1669359479&t=17cdc5ff9204bc85cbfe0d44af4f9753',
				sex: '',
				account: "nihao"
			};
		},
		methods: {
			onPageTo(url) {
				uni.navigateTo({
					url: url
				})
			},
			//带参数转一卡通页面
			HxGopage(url,o){
				uni.navigateTo({
					url: url+`?studentId=${o}`
				})
			},
			//进入隐患界面
			hidden(url,id){
				uni.navigateTo({
					url: url+`?studentId=${id}`
				})
			}
			
		},
		created() {
			// this.$axios.get("/yz/getphoto/1", {
			// 	responseType: "blob"
			// }).then(res => {
			// 	let blob = new window.Blob([res.data]);
			// 	let url = window.URL.createObjectURL(blob);
			// 	this.imgSrc = url;
			// 	console.log(res)
			// });


			this.$axios.get("/api/v1/student/myinfo/28").then(res => {
				console.log(res.data.data);
				this.studentId=res.data.data.id
				this.sex = res.data.data.gender;
				this.account = res.data.data.name;
				if (res.data.data.gender == '男') {
					this.sex = "man";
				} else {
					this.sex = "woman";
				};
				uni.setStorageSync("studentId",this.studentId);
				uni.setStorageSync("classId",res.data.data.classes.id);
			});
			

		}
	}
</script>

<style lang="scss">
	.icon {
		flex-direction: column;
	}

	.wrap {
		padding: 12px;
	}

	.demo-layout {
		height: 25px;
		border-radius: 4px;
	}

	.bg-purple {
		background: #CED7E1;
	}

	.bg-purple-light {
		background: #e5e9f2;
	}

	.bg-purple-dark {
		background: #99a9bf;
	}

	.info {
		flex-direction: row;
	}
</style>
